package cn.lml.lession.user.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lml.lession.user.dao.UserMapper;
import cn.lml.lession.user.model.User;
import cn.lml.lession.user.service.UserService;

@Service
public class UserServiceImpl implements UserService{

	private static final Logger logger=LoggerFactory.getLogger(UserServiceImpl.class);	
	@Autowired
	private UserMapper userMapper;

	@Override
	public Integer insertUser (User user){
		logger.debug("新增数据 "+user);
		return userMapper.insertUser(user);
	}

	@Override
	public Integer deleteByUid (Integer uid){
		logger.debug("通过Uid删除数据 "+uid);
		return userMapper.deleteByUid(uid);
	}

	@Override
	public Integer updateByUid (User user){
		logger.debug("通过Uid修改数据 "+user);
		return userMapper.updateByUid(user);
	}

	@Override
	public User selectByUid (Integer uid){
		logger.debug("通过Uid查找数据 "+uid);
		return userMapper.selectByUid(uid);
	}

	@Override
	public List<User> queryUser(Map<String, Object> cond) {
		logger.debug("分页查询数据 "+cond);
		return userMapper.queryUser(cond);
	}

	@Override
	public Integer countUser(Map<String, Object> cond) {
		logger.debug("统计数据 "+cond);
		return userMapper.countUser(cond);
	}

	@Override
	public User findByUsername(String username) {
		return userMapper.findByUsername(username);
	}

}